//
//  MPDeviceObject.m
//  M800Project
//
//  Created by 姚宗超 on 14/11/5.
//  Copyright (c) 2014年 姚宗超. All rights reserved.
//

#import "MPDeviceObject.h"
#import "NSDictionary+Common.h"
#import "NSString+Common.h"
#import "MPUserDefaultHelper.h"
#import "UIDeviceHardware.h"

@implementation MPDeviceObject
DEF_SINGLETON(MPDeviceObject);

- (void)setupUserDefaultDataWithInfo:(NSDictionary *)infoDic
{
    self.deviceId = [UIDeviceHardware deviceIdentifier];
    self.isFirstLogin = [infoDic boolValueForKey:@"isFirstLogin"];
    self.bRegisterUserId = [infoDic stringValueForKey:@"bRegisterUserId"];
    self.bRegisterChannelId = [infoDic stringValueForKey:@"bRegisterChannelId"];
    self.bRegisterAppId = [infoDic stringValueForKey:@"bRegisterAppId"];
    self.deviceModel = [UIDevice currentDevice].model;
    self.osVersionString = [UIDevice currentDevice].systemVersion;
    self.deviceType = eMPDeviceTypeIOS;
}

- (void)setIsFirstLogin:(BOOL)isFirstLogin
{
    _isFirstLogin = isFirstLogin;
    [MPUserDefaultHelper saveParamToUserDefault];
}

- (NSMutableArray *)platformCodeArray
{
    if (!_platformCodeArray) {
        _platformCodeArray = [NSMutableArray new];
    }
    return _platformCodeArray;
}

- (NSMutableArray *)durationCodeArray
{
    if (!_durationCodeArray) {
        _durationCodeArray = [NSMutableArray new];
    }
    return _durationCodeArray;
}

- (NSMutableArray *)yearRateCodeArray
{
    if (!_yearRateCodeArray) {
        _yearRateCodeArray = [NSMutableArray new];
    }
    return _yearRateCodeArray;
}

- (NSMutableArray *)platformNameArray
{
    if (!_platformNameArray) {
        _platformNameArray = [NSMutableArray new];
    }
    return _platformNameArray;
}

- (NSMutableArray *)durationNameArray
{
    if (!_durationNameArray) {
        _durationNameArray = [NSMutableArray new];
    }
    return _durationNameArray;
}

- (NSMutableArray *)yearRateNameArray
{
    if (!_yearRateNameArray) {
        _yearRateNameArray = [NSMutableArray new];
    }
    return _yearRateNameArray;
}


@end
